package com.etc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("redirectapi")
public class RedirectController {

	@RequestMapping(value = "test1")
	public String test1() {
		System.out.println("redirectapi test1");
		return "test1";
	}

	@RequestMapping(value = "test2")
	public String test2() {
		System.out.println("redirectapi test2:");
		//重定向,地址栏变化了,相对目录
		return "redirect:test1";
	}
	
	@RequestMapping(value = "test3")
	public String test3() {
		System.out.println("redirectapi test3:");
		//重定向,地址栏变化了 如果加入了一个/跳转到了根目录
		//http://localhost:7777/springmvc003/test1
		return "redirect:/test1";
	}
}
